# 字典的创建，键重复则覆盖
dict1 = {
    "name": "Ginna",
    "gender": False,
    "age": 18
}
dict2 = {}
dict3 = dict()
print(dict1, dict2, dict3, sep="#")

# 新增键值对
dict1["height"] = 160
# 获取键值对
print(dict1.get("name"))
print(dict1["name"])
# 修改键值对
dict1["name"] = "Tom"
# 删除字典
# del dict1

# 字典的遍历
print(dict1.items())
for key, value in dict1.items():
    print(key, value, sep="---")
for key in dict1.keys():
    print(key)
for value in dict1.values():
    print(value)

# 字典的常用方法
dict1.pop("height")
dict1.popitem()  # 从末尾删除掉一个键值对
dict1.clear()
